package org.learn.java;

public class ThreeSum {

	public static int count(int[] a) {
		int cnt = 0;
		int N = a.length;
		for (int i = 0; i < N; i++)
			for (int j = i + 1; j < N; j++)
				for (int k = j + 1; k < N; k++)
					if (a[i] + a[j] + a[k] == 0)
						++cnt;

		return cnt;
	}
}
